Namespace - LJCNetCommon
Parameters
x - The compare object.
y - The compare to object.
Returns
The integer that indicates the order relationship of the objects.
Syntax
C# |
public static Int32 CompareNull(Object x, Object y)
|
Compare null values. (DE)
Remarks
-2 - Neither object is null.
-1 - Null object x precedes object y.
0 - Object x and object y are both null.
1 - Object x follows null object y.
Example
C# |
using System;
using LJCNetCommon;
public class NameComparer : IComparer<ClassName>
{
public int Compare(ClassName x, ClassName y)
{
int retValue;
retValue = NetCommon.CompareNull(x, y);
if (-2 == retValue)
{
retValue = NetCommon.CompareNull(x.Name, y.Name);
if (-2 == retValue)
{
retValue = string.Compare(x.Name, y.Name, true);
}
}
return retValue;
}
}
|
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.